//消息回复模板
module.exports = (options) => {
    let str = `
    <xml>
    <ToUserName><![CDATA[${options.toUserName}]]></ToUserName>
    <FromUserName><![CDATA[${options.fromUserName}]]></FromUserName>
    <CreateTime>${options.date}</CreateTime>`;
    
    switch (options.type) {
        case 'text':
            str += `
            <MsgType><![CDATA[text]]></MsgType>
            <Content><![CDATA[${options.content}]]></Content>`
            break;
        case 'image':
            str += `
            <MsgType><![CDATA[image]]></MsgType>
            <Image>
            <MediaId><![CDATA[${options.mediaId}]]></MediaId>
            </Image>`
            break;
        case 'voice':
            str += `
            <MsgType><![CDATA[voice]]></MsgType>
            <Voice>
            <MediaId><![CDATA[${options.mediaId}]]></MediaId>
            </Voice>`
            break;
        case 'video':
            str += `
            <MsgType><![CDATA[video]]></MsgType>
            <Video>
            <MediaId><![CDATA[${options.mediaId}]]></MediaId>
            <Title><![CDATA[${options.title}]]></Title>
            <Description><![CDATA[${options.description}]]></Description>
            </Video>`
            break;
        case 'music':
            str += `
            <MsgType><![CDATA[music]]></MsgType>
            <Music>
            <Title><![CDATA[${options.title}]]></Title>
            <Description><![CDATA[${options.description}]]></Description>
            <MusicUrl><![CDATA[${options.musicUrl}]]></MusicUrl>
            <HQMusicUrl><![CDATA[${options.hqMusicUrl}]]></HQMusicUrl>
            <ThumbMediaId><![CDATA[${options.mediaId}]]></ThumbMediaId>
            </Music>`
            break;
        case 'location':
            str += `
            <MsgType><![CDATA[location]]></MsgType>
            <Location_X>${options.Location_X}</Location_X>
            <Location_Y>${options.Location_Y}</Location_Y>
            <Scale>${options.scale}</Scale>
            <Label><![CDATA[${options.LocationDetail}]]></Label>
            <MsgId>${options.msgId}</MsgId>`
            break;
        default:
            str += `
            <MsgType><![CDATA[text]]></MsgType>
            <Content><![CDATA[你在说什么，我好像听不太懂]]></Content>`
    }

    str += `</xml>`
    return str
}